﻿#ifndef UDPASSISTANT_H
#define UDPASSISTANT_H

#include <QMainWindow>

#include <QThread>
#include <QTcpSocket>
#include <QUdpSocket>
#include "myserver.h"
#include <QButtonGroup>

namespace Ui {
class UdpAssistant;
}

class UdpAssistant : public QMainWindow
{
    Q_OBJECT

public:
    explicit UdpAssistant(QWidget *parent = nullptr);
    ~UdpAssistant();

    Ui::UdpAssistant *ui;

    SocketHelper* sockethelper;                //socket创建辅助对象
    QList<MyThread*> list_thread;              //线程列表
    QList<SocketInformation> list_information; //socket信息列表

    MainWindow* mainwindow;
    QButtonGroup* m_udpModeGroup;

private slots:
    void on_btn_udpClearRec_clicked();

    void on_btn_udpClearSend_clicked();

    void on_btn_udpSend_clicked();

    void on_btn_udpBind_clicked();

    void on_udpModeChange(int id);

    void on_chk_udpGroup_clicked(bool checked);

private:

    MyServer* m_tcpServer;

   QUdpSocket* m_udpSocket;

public slots:

    void UdpReadData();

};

#endif // UDPASSISTANT_H
